import {Component, OnInit} from '@angular/core';
import {SiteService} from './service/site.service';
import {Site} from './entity/site';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
    site: Site;

    constructor(private siteService: SiteService) {
    }

    ngOnInit(): void {
        this.siteService.get().subscribe(site => {
            this.site = site;
        });

        if (window.location.hostname === 'www.duoec.com') {

        }

        if (window.location.hostname === 'doc.duoec.com') {
            window.alert('请切换到公司域名：http://doc.inngke.net');
            window.location.href = 'http://doc.inngke.net' + window.location.pathname;
        }
    }

    getHost() {
        return window.location.hostname;
    }
}
